import request from '@/utils/request'
// USER_CODE_BEGIN -- huodong
/**
 * 获取活动列表
 * @param params
 * @returns
 */
export const getActivityListApi: IGetActivityListApi = function(params) {
    return request.get(`htscrm/activity/list`, {params})
}

/**
 * 获取活动详情
 * @param id 活动id
 * @returns
 */
export const getActivityInfoApi: IGetActivityDetailApi = function(id) {
    return request.get(`htscrm/activity/info/${id}`);
}

/**
 * 获取活动链接
 * @param id 活动id
 * @returns
 */
export const getActivityUrlApi: IGetActivityUrlApi = function(id) {
    return request.get(`htscrm/activity/activity_url/${id}`);
}

/**
 * 添加活动
 * @param params
 * @returns
 */
export const addActivityApi: IAddActivityApi = function(params) {
    return request.post('htscrm/activity/add', params)
}

/**
 * 编辑活动
 * @param params
 * @returns
 */
export const editActivityApi: IUpdateActivityApi =function(params) {
    return request.post(`htscrm/activity/edit/${params.id}`, params)
}

/**
 * 编辑活动顺序
 * @param params
 * @returns
 */
export const editSortActivityApi: IUpdateActivityApi =function(params) {
    return request.post(`htscrm/activity/sort/${params.id}`, params)
}

/**
 * 删除活动
 * @param id
 * @returns
 */
export const deleteActivityApi: IDeleteActivityApi = function(id) {
    return request.post(`htscrm/activity/del/${id}`)
}

/**
 * 批量删除
 * @param ids
 * @returns
 */
export const batchDeleteActivityApi: IBatchDeleteActivityApi = function(ids) {
    return request.post(`htscrm/activity/delete`, {ids})
}

/**
 * 批量更新状态
 * @param ids
 * @returns
 */
export const batchUpdateActivityStatusApi: IBatchUpdateActivityStatusApi = function(data) {
    return request.post(`htscrm/activity/batch_status`, data)
}


/**
 * 复制活动
 * @param ids
 * @returns
 */
export const copyActivityApi: ICopyActivityApi = function(type, data) {
    return request.post(`htscrm/activity/copy/${type}`, data)
}


/**
 * 获取分类最后的时间
 * @param id
 * @returns
 */
export const getLastTimeApi: IGetLastTimeApi = function(data) {
    return request.post(`htscrm/activity/last_time`, data)
}



/**
 * 获取档期用户
 * @param id
 * @returns
 */
export const getAnalysisDataApi: IGetAnalysisDataApi = function(params) {
    return request.get(`htscrm/activity/cate_analysis/${params.cate_id}`, {params})
}



/**
 * 活动用户明细
 * @param id
 * @returns
 */
export const getActivityAnalysisDataApi: IGetAnalysisDataApi = function(params) {
    return request.get(`htscrm/activity/activity_analysis/${params.id}`, {params})
}

/**
 * 门店统计
 * @param id
 * @returns
 */
export const getStoreAnalysisDataApi: IGetAnalysisDataApi = function(params) {
    return request.get(`htscrm/activity/store_analysis/${params.id}`, {params})
}

/**
 * 重新发放
 * @param id
 * @returns
 */
export const resendApi: IResendApi = function(data) {
    return request.post(`htscrm/activity/resend/${data.id}`, data)
}

/**
 * 获取用户观看日志
 * @param id
 * @returns
 */
export const getUserViewLogApi: IGetUserViewLogApi = function(params) {
    return request.get(`htscrm/activity/report_log/${params.id}`, {params})
}

/**
 * 获取用户观看日志
 * @param id
 * @returns
 */
export const getUserViewChatApi: IGetUserViewChatApi = function(params) {
    return request.get(`htscrm/activity/chat_list/${params.huodong_id}`, {params})
}

export function bindFdApi(data: any) {
    return request.post(`htscrm/chat/bindFd`, data);
}

export function delFdApi(data: any) {
    return request.post(`htscrm/chat/delFd`, data);
}


/**
 * 发送消息
 */
export function addChatApi(data: any) {
	return request.post(`htscrm/chat/addchat`, data);
}

export function getOnlineDataApi(data: any) {
	return request.get(`htscrm/activity/get_online_data/` + data.id);
}


// USER_CODE_END -- huodong
